const router = require('koa-router')({prefix: '/files'});
const controller = require('controller/files.js');
const multer = require('lib/utils/koaMulter');

/**
 * @api {post} /files/:type 文件上传通用接口
 * @apiVersion 1.0.0
 * @apiName filesType
 * @apiGroup 文件模块
 * @apiHeader {String} Authorization 用户授权token
 * @apiSampleRequest /files/:type
 * @apiSuccessExample {json} 请求成功：
 * {}
 */
router.post('/uploads/:type', multer.single('file'), controller.upload);

/**
 * @api {delete} /files/delete 删除文件
 * @apiVersion 1.0.0
 * @apiName delete
 * @apiGroup 文件模块
 * @apiHeader {String} Authorization 用户授权token
 * @apiSampleRequest /files/delete
 * @apiSuccessExample {json} 请求成功：
 * {}
 */
router.delete('/delete', controller.delete);

module.exports = router;
